import { AxiosHeaders, AxiosHeaderValue } from "axios"
import { ConversationGroupListFace } from "./chat.type"

/** 流事件处理器类型定义 */
export type StreamEventHandlers = {
    /** 收到数据时触发 */
    onData: (content: chatData) => void
     /** 收到标题数据时触发 */
    onTitleData: (content: ConversationGroupListFace) => void
    /** 发生错误时触发 */
    onError: (error: Error) => void
    /** 流结束时触发 */
    onEnd: () => void
}

// ================== 类型定义 ==================
export type ContentType = 'text' | 'image' | 'code'

export type Headers = AxiosHeaders | (Partial<AxiosHeaders & { Accept: AxiosHeaderValue; "Content-Length": AxiosHeaderValue; "User-Agent": AxiosHeaderValue; "Content-Encoding": AxiosHeaderValue; Authorization: AxiosHeaderValue } & { 'Content-Type': ContentType }> & Partial<{ get: AxiosHeaders; delete: AxiosHeaders; head: AxiosHeaders; options: AxiosHeaders; post: AxiosHeaders; put: AxiosHeaders; patch: AxiosHeaders; purge: AxiosHeaders; link: AxiosHeaders; unlink: AxiosHeaders } & { common: AxiosHeaders }>)

export interface chatData {
    sessionId: string
    content: string,
    reasoning_content: string,
    total_tokens: number,
    thinking_time: number
}